package com.ltmall.api.manager;

import com.ltmall.api.bean.*;
import com.ltmall.api.entity.JsonOrder;
import com.ltmall.api.util.PageUtil;

import java.math.BigDecimal;
import java.util.List;

public interface OrderManager {
    //创建订单
    public boolean addOrder(Order order);

    //创建订单内容
    public boolean addOrderContent(OrderContent content);

    //添加订单物流
    public boolean addOrderLogistic(OrderLogistic oLogistic);

    //删除订单
    public boolean delOrder(int orderID);

    //获取订单列表
    public List<Order> orderList(int userID, int station, PageUtil page);

    public List<Order> diretorPrivilegeOrderList(int userID);

    //修改订单的状态
    public boolean updateOrderStation(int orderID, int station);

    //修改订单的状态
    public boolean updateOrderStationAndTransaction(int orderID, int station, int transType,
                                                    String transNumber);

    //修改订单价格
    public boolean updateOrderFee(int orderID, double fee);

    public boolean updateOrderFeeDirector(int orderID, double fee);

    //获取订单详情
    public List<OrderContent> getOrderContent(int orderID);

    //获取订单
    public Order getOrder(int orderID);

    //修改订单
    public boolean orderUpdate(float wxFee, float zfbFee, float coupopnFee, float giftcardFee,
                               String message, int station, int orderID, int transactionType,
                               String invoice, String congradulations, String deliveryTime);

    //添加商品评价
    public boolean addComment(Comment comment);

    //获取订单物流
    public OrderLogistic getOrderLogistic(int orderID);

    //商品是否已经评价
    public boolean isComment(int orderID, int goodsID, String goodsFormat, int userID);

    //添加退款
    public boolean addRefund(Refund refund);

    //退款列表
    public List<Refund> refundList(int userID, PageUtil page);

    //判断商品是否在活动中
    public ActivityPrice getActivityPrice(int goodsID, String format);

    //添加交易号
    public boolean addTradeNo(TradeNo no);

    //更新支付单
    public boolean tradeNoUpdate(TradeNo no);

    //获取交易号
    public TradeNo getTradeNo(String no);

    //添加订单时间
    public boolean addOrderTime(OrderTime orderTime);

    //修改订单时间
    public boolean updateOrderTime(int orderID, int type, long time);

    //获取订单时间
    public OrderTime getOrderTime(int orderID);

    //添加商店客户
    public boolean addShopClienit(ShopClient shopClient);

    //修改礼品卡金额
    public boolean deleteCouponCount(int userID, float fee);

    //修改活动商品的库存
    public boolean updateActivityGoodsSellout(int activityID, int goodsID, String goodsFormat,
                                              int number);

    //添加商店消息
    public boolean addShopNews(ShopNews news);

    //获取最新的消息
    public ShopNews getShopNews(int shopID, int userID);

    //取消订单
    public boolean cancelOrder(int orderID);

    //添加销售记录
    public boolean addSellout(SelloutRecord selloutRecord);

    //获取订单数量
    public int orderNumber(int userID, int station);

    //未完成的退款订单
    public int unFinishRefund(int userID);

    //获取退款
    public Refund getRefund(int orderID);

    //购物车内商品列表
    public List<String> distinctNumberInCart(final String[] cartIDs);

    //获取该商品的总数
    public int goodsNumberInCart(int goodsID, String[] cartIDs);

    //活动期间内的订单
    public List<Order> activityOrder(long startTime, long endTime, int userID);

    //订单内容里面是否存在活动商品
    public OrderContent getActivityOrderContent(int goodsID, String goodsFormat, int orderID);

    //修改活动库存
    public boolean updateActivityGoodsNumber(int activityID, int goodsID, String goodsFormat,
                                             int number);

    //获取仓库
    public int getStoreHouse(int shopID);

    //获取商店Id
    public int getShopID(int bussinessID);

    //获取参加指定团购的数量
    public int groupOrderNumber(int userID, int groupId);

    //开团-未支付是锁定状态
    public ThGroupBuying groupAdd(OrderContent order, ThGroupBuyingRules rule, int userID);

    //减少团库存
    public boolean decreaseStocks(ThGroupBuyingRules rule, int num);

    //增加销量
    public boolean increaseStocks(int groupRuleId, int num);

    //回滚库存
    public boolean rollbackStocks(int rulesID, int num);

    //减少疯抢库存
    public boolean decreasePanicStocks(int panicID, int goodsID, String format, int num);

    //回滚疯抢销量
    public boolean rollbackPanicStocks(int panicID, int goodsID, String format, int num);

    //修改团
    public ThGroupBuying groupUpdate(ThGroupBuying group);

    //回写订单的团购id
    public boolean orderContentGroupIdAdd(OrderContent order);

    //修改订单信息
    public boolean orderContentUpdate(OrderContent content);

    // 获取用户已经参加的团购商品id
    public int groupOrderGoodsIdGet(int userID, int groupRulesId);

    //获取订单的普通商品总价
    public BigDecimal orderSubUnderwritingTotalFee(int orderId);

    /**
     * 判断购物车中的价格和数据库中的价格是否相等
     * @param price
     * @param skuId
     * @return
     */
    public boolean isPriceSame(final String price, final String skuId);

    public ActivityPrice getActivityPriceBySkuID(int skuID);

    public List<JsonOrder> ordersadd(List<Cart> cartList, int userID, int addressID, int selfAddID);

    public boolean reduceActivityNumber(int activityID, int skuID, int number);

    public boolean updateActivityGoodsSellout(int activityID, int skuID, int number);
}
